\documentclass[11pt,a4paper]{article} 
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{float}
\usepackage{listings}
\author{David ~Bondatti db2626\@columbia.edu \\ \and Haomin ~Zhu hz2216\@columbia.edu \\ \and Kuangye ~Guo kg2372\@columbia.edu\\ \and Youhan ~Sun ys2465\@columbia.edu \\ \and Yuan ~Wang yw2326\@columbia.edu}
\title{Programming Languages and Translators \\ GAS Language White Paper}
\begin{document}
\maketitle
\section*{Introduction}
Although in the past Image Processing (or more generally Signal Processing) was mainly employed by people with a strong technical background, as engineers or scientists, nowadays it has become increasingly popular among non-technical users due to the introduction of digital cameras. While technical people are not afraid of using complex libraries or expensive software to process their images, a \emph{normal} user can not be supposed to do that. Our main goal is therefore to design a \emph{simple} language, called \emph{Graphics Assembler Scripting} (GAS) language, which implements the most used Image Processing techniques and offers a \emph{strong} and \emph{reliable} basis for future developments. GAS' main purpose is to simplify lives of unexperienced users who need to apply effects to their pictures in a very intuitive way. But GAS can also be useful to experienced users that need to perform batch processing on a large amount of data in a quick and easy manner.

\section*{Background}
In this section we briefly examine some other tools that users might employ to manipulate their images and list why they are problematic and how GAS overcomes their issues.
\begin{enumerate}
\item \emph{Other programming languages} - C/C++ and JAVA are sophisticated general-purpose languages and they obviously come with functionalities to manipulate images, in a native way or through external libraries. Anyway, they are really complex: anyone who wants to apply even the simplest type of effect with those languages has to spend a lot of efforts dealing with things that most of the times are not related to Image Processing, i.e.\ algorithms, data structure, system calls, etc.. Furthermore, this intrinsic difficulty precludes their use to people having no background in programming. Here is where our language is needed: it provides image-oriented features which let users focus exclusively on what they want to do, not how they have to. 
\item \emph{Technical computing tools} - MATLAB offers a powerful Image Processing toolbox. It might look easier to use than C/C++ or JAVA, but not that much. Users not familiar with programming languages are still in trouble. Moreover, MATLAB would be quite expensive to buy if the only purpose is images manipulation.  
\item \emph{Professional editing software} - Photoshop, Lightroom and Aperture provide a number of functions for Image Processing. Although they have user-friendly interfaces, they are quite expensive. Moreover, it often takes some time to learn how to use all their features. Non professional users might be afraid of that. Other disadvantages are that they lack in batch processing abilities and their functions are hard to extend and enhance. Our language would provide instead several features for batch processing and let user easily specify how to perform it.
\end{enumerate} 

\section*{Language features}
The following are the main features we want GAS to have. These will drive us through its design and implementation.
\begin{enumerate}
\item \emph{Simple} - The main goal of our language is to help users easily apply Image Processing techniques and tools to their data. In our opinion, even an unexperienced user should be able to apply simple and elaborate effects on a set of pictures in few lines of code, without having to know the details of how a particular algorithm is implemented - details that are not always hided by libraries and programs available today. Our language will have a simple syntax, a reduced set of system calls and data types in order to be quickly learned and used by anyone. 
\item \emph{Image-Oriented} - Our language will be an Image-Oriented language. Image-Oriented obviously comes from Object-Oriented... There are a lot of Object-Oriented languages (Java, C++, C\#, etc.) and our purpose is certainly not to create another better OO language. But we intend to steal the main feature of the OO paradigm and apply it to our "world". That main feature corresponds to the definition of entities that are important in an application's domain, with their characteristics and behaviors. What should be the main entity in a language for Image Processing? That's easy: the image! Thus our language reminds an Object-Oriented language, but all the objects that can be defined are related with images. Each object will have its own properties and applicable actions: for instance each image has a width, a height and is made of a certain number of pixels. We basically shape these attributes and let users edit them by applying suitable effects, thereby changing the appearance of the image. We think this kind of paradigm is quite natural for users and compared with other existing tools, an image-oriented language will definitely maintain things simple without affecting their power.  
\item \emph{Portable} - Since programs in our language will be translated into JAVA code by the compiler, they will run over any machine for which a JVM is available. But JVMs have been built for every major system architecture/OS. This combination will make life easier for users that: \emph{i.} do not have to worry about an infinite list of dependencies to install and run even a simple program \emph{ii.} are free to share their code without troubles. 
\item \emph{Extensible} - While designing new software system is important to take into consideration its future growth. In the first stage, our system will provide basic functionalities so that it will be kept small and simple but it will include mechanisms in order to be extensible, i.e. by letting users add new capabilities without having to make major changes to the infrastructure. The system will provide different interfaces so that people will be allowed to enhance it. 
\item \emph{Powerful} - We are not going to build a general-purpose language which allows any kind of computation: our language will be expressly focused on Image Processing. That means that we are allowed to build the language infrastructure by choosing the techniques that most fit our necessities, without having to make trade-offs. Compared with other more complex languages such as MATLAB or Python, which also provide libraries for Image Processing, our language will be simpler but not less powerful and as efficient as them. Besides the basic functions of image manipulation (resize, rotate, color corrections, etc.) and basic effects (filters, edge detection, etc.) we will also provide some popular features such as Array or Mosaic Generation, that are expression of Digital Art. As already said, the libraries are extensible and more advanced features can be provided by different developers in the future. 
\end{enumerate}

\section*{Examples}
We provide two sample programs that show GAS in action. Note that the actual syntax might be changed during following phases.
\begin{enumerate}

\begin{figure}[H]
\begin{minipage}{\textwidth}
\centering
\subfigure[The Beatles]{
\label{Fig.sub.1}
\includegraphics[width=0.4\textwidth]{simple.jpg}}
\subfigure[Palette]{
\label{Fig.sub.2}
\includegraphics[width=0.4\textwidth]{palette.jpg}}
\caption[Example Images]{Example Images\footnote[1]{The image comes from the flikr.}}
\label{Fig.lable}
\end{minipage}
\end{figure}

\item \emph{Simple Example}
\lstset{breaklines}
\lstset{extendedchars=false}
\begin{lstlisting}
//For the Beatles image
Imagematrix beatles; 
Image imageset[];
imageset[0:3].imageload("Starr.jpg", "Harrison.jpg", "Lennon.jpg", "McCartney.jpg");
imageset[0].paint(#yellow);
imageset[1].paint(#blue);
imageset[2].paint(#green);
imageset[3].paint(#red);
beatles.fill(imageset[], #square);
beatles.show(600,600);
\end{lstlisting}

\item \emph{Little Complex}
\lstset{breaklines}
\lstset{extendedchars=false}
\begin{lstlisting}
//For the palette image
const int maxN=16;
Imagematrix palette;
Image imageset[];
imageset[0:maxN^2-1].imageload("./image_"$1".jpg");
imageset[].sort($a.hue < $b.hue);
palette(0:maxN-1,0:$1).fill(imageset[(($1+$2+1)^2+($1-$2+1))/ 2];
palette(1:maxN-1,$1:maxN-1).fill(imageset[maxN^2-((2*maxN-$1-$2-1)^2+
($1-$2+1))/2]);
palette.show(600,600); 
\end{lstlisting}

\end{enumerate}

\end{document}